package vn.com.demand.lux.model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import org.apache.commons.dbutils.ResultSetHandler;

/**
 * @author Nguyen The Thinh
 */
public class CustomerBean implements ResultSetHandler{

	private String customerCode;
	private String customerName;
	private String address;

	public Object handle(ResultSet rs) throws SQLException {
		ArrayList<CustomerBean> list = new ArrayList<CustomerBean>();
		while(rs.next()) {
			CustomerBean bean = new CustomerBean();
			bean.setCustomerCode(rs.getString("code"));
			bean.setCustomerName(rs.getString("name"));
			bean.setAddress(rs.getString("address"));
			list.add(bean);
		}
		return list.toArray(new CustomerBean[0]);
	}

	public String getCustomerCode() {
		return customerCode;
	}

	public void setCustomerCode(String customerCode) {
		this.customerCode = customerCode;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

}
